package com.zc.controller;

import com.zc.service.RedisPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: cong
 * @create: 2025/3/11
 */
@RestController
public class RedisController {

    @Autowired
    private RedisPublisher redisPublisher;

    @PostMapping("/publish/{topic}/{message}")
    public String publish(@PathVariable("topic") String topic, @PathVariable("message") String message) {
        redisPublisher.publish(topic, message);
        return "success: " + message;
    }
}
